import stockApi from "@/api/declaration/erp/stockApi"
import httpRequest from "@/config/axios/httpRequest"
import { StockInModel } from "@/models/erp/StockInModel"


// ERP 其它入库单 API
export const StockInApi = {
  // 查询其它入库单分页
  getStockInPage: async (params: any) => {
    return await httpRequest.get(stockApi.GetStockInPage, params)
  },

  // 查询其它入库单详情
  getStockIn: async (id: number) => {
    return await httpRequest.get(stockApi.GetStockIn, { params: { id} })
  },

  // 新增其它入库单
  createStockIn: async (data: StockInModel) => {
    return await httpRequest.post(stockApi.CreateStockIn, data)
  },

  // 修改其它入库单
  updateStockIn: async (data: StockInModel) => {
    return await httpRequest.put(stockApi.UpdateStockIn, data)
  },

  // 更新其它入库单的状态
  updateStockInStatus: async (id: number, status: number) => {
    return await httpRequest.put(stockApi.UpdateStockInStatus, { id, status })
  },

  // 删除其它入库单
  deleteStockIn: async (ids: number[]) => {
    return await httpRequest.delete(stockApi.DeleteStockIn, { params: { ids: ids.join(',') } })
  },

  // 导出其它入库单 Excel
  exportStockIn: async (params) => {
    return await httpRequest.download(stockApi.ExportStockIn, params)
  }
}
